<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <meta
      name="description"
      content="汇融名企是面向全国商家服务的大型互联网平台，为商家提供流量扶持，引导品牌曝光；为消费者提供风云榜单，招商加盟，引导实现消费，达成合作，上汇融名企实现共赢。"
    />
    <title>加盟列表-汇融名企</title>
    <link rel="stylesheet" href="./css/common.css" />
    <link rel="stylesheet" href="./css/paging.css" />
    <style>
      #category {
        background: #fff;
        box-shadow: 0px 3px 10px 0 #d9d9d9;
        min-height: 85px;
      }
      #header-page {
        background: #fff;
      }
      .content {
        max-width: 1500px;
        margin: 20px auto 40px;
      }
      #card-wrapper {
        min-height: 637px;
      }
      .card {
        width: 320px;
        height: 292px;
        background: rgba(255, 255, 255, 1);
        border: 3px solid rgba(244, 244, 244, 1);
        padding: 22px 19px 0 19px;
        margin-right: 14px;
        display: inline-block;
        position: relative;
        transition: 0.2s ease-in-out;
        margin-bottom: 40px;
        text-align: left;
      }
      .card:hover {
        border-color: rgba(248, 62, 37, 1);
      }
      .card-img {
        width: 319px;
        height: 182px;
        margin: auto;
      }
      .card-time {
        width: 319px;
        height: 36px;
        background: rgba(0, 0, 0, 0.52);
        position: absolute;
        bottom: 110px;
        text-align: center;
        font-size: 14px;
        font-weight: 400;
        color: #ffffff;
        line-height: 36px;
        margin-left: 1px;
      }
      .card-model {
        display: inline-block;
        width: 122px;
        background: #dba448;
      }
      .card-fee {
        display: inline-block;
        width: 192px;
      }
      .card-text {
        font-size: 18px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(51, 51, 51, 1);
        margin-top: 23px;
        height: 25px;
      }
      .card-tag {
        height: 30px;
        width: 150px;
        background: url('./image/picture/rankingList_card_tag.png');
        position: absolute;
        right: 22px;
        top: 22px;
        transition: 0.2s ease-in-out;
        font-size: 14px;
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
        line-height: 30px;
        text-indent: 13px;
      }
      .card-brand {
        font-size: 14px;
        color: rgba(153, 153, 153, 1);
        margin-top: 17px;
      }
      .card-detail {
        position: absolute;
        font-size: 18px;
        font-weight: bold;
        color: rgba(248, 62, 37, 1);
        line-height: 19px;
        cursor: pointer;
        right: 21px;
        bottom: 27px;
      }
      .title {
        margin-top: 44px;
      }
      .title-divider-wrapper {
        white-space: nowrap;
        overflow: hidden;
      }
      .title-divider-colorbar {
        width: 187px;
        height: 3px;
        background: rgba(219, 164, 72, 1);
        display: inline-block;
      }
      .title-divider {
        width: 1307px;
        height: 3px;
        background: rgba(209, 209, 209, 1);
        display: inline-block;
      }
      .title-more {
        font-size: 14px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(153, 153, 153, 1);
        line-height: 28px;
        position: absolute;
        top: 0;
        right: 0px;
        cursor: pointer;
      }

      .title-more span {
        position: relative;
        bottom: 1px;
      }
      .not-found {
        height: 100%;
        font-size: 18px;
        font-weight: bold;
        text-align: center;
        line-height: 400px;
        display: none;
      }
      .card-detail-guesss{
        cursor: pointer;
      }
    </style>
  </head>
  <body>
    <!-- <div id="header-page"></div> -->
    <!--#include virtual="/header.html" -->
    <div class="content-wrapper">
      <div id="category"></div>
      <div class="content">
        <div id="card-wrapper">
          <div class="not-found" id="not-found">暂无数据</div>
        </div>
        <div id="page" class="page_div"></div>
        <!-- <div class="card">
          <div class="card-img">
            <img class="card-img" src="" alt="加盟列表-汇融名企" />
          </div>
          <div class="card-tag">活动行业：建材行业</div>
          <div class="card-time">
            <div class="card-model">经营模式：加盟</div>
            <div class="card-fee">预计加盟成本：10~20W</div>
          </div>
          <div class="card-text need-text-overflow">
            长沙奶茶房河北石家庄市裕华东路店...
          </div>
          <div class="card-brand">
            加盟行业：吃喝玩乐/小吃/饮品
          </div>
          <div class="card-detail">加盟详情</div>
        </div> -->
        <div class="title" style="margin-top: 40px; margin-bottom: 40px;">
          <div style="position: relative;">
            <img
              src="./image/picture/index_cnxhbt_img.png"
              alt="更多加盟信息-汇融名企"
            />
            <a href="" class="title-more">MORE <span>></span></a>
          </div>
          <div class="title-divider-wrapper">
            <div class="title-divider-colorbar"></div>
            <div class="title-divider"></div>
          </div>
        </div>
        <div class="guess" id="guess"></div>
      </div>
    </div>
    <!-- <div id="footer-page"></div> -->
    <!--#include virtual="/footer.html" -->
    <script src="./js/jquery-1.11.0.min.js"></script>
    <script src="./js/jquery.my-message.1.1.js"></script>
    <script src="./js/utils.js"></script>
    <script src="./js/paging.js"></script>
    <script src="./js/category.js"></script>
    <script src="./js/api.js"></script>
    <script type="text/javascript">
      $(function () {
        var historyPath
        if (
          document.referrer &&
          (document.referrer.indexOf('chmqlive') != -1 ||
            document.referrer.indexOf('39.107.45.63') != -1)
        ) {
          historyPath = document.referrer
            .split('http://')[1]
            .split('/')[1]
            .split('.')[0]
        } else {
          historyPath = ''
        }
        var flag = historyPath != 'merchantsJoinList'
        // if (!document.referrer || flag) {
        //   sessionStorage.removeItem('title')
        // }
        if (flag) {
          sessionStorage.removeItem('type_pid')
          sessionStorage.removeItem('type_ids')
        }
        var params = getURLParams()
        if (sessionStorage.getItem('type_pid')) {
          params.type_id = sessionStorage.getItem('type_pid')
        }
        if (sessionStorage.getItem('type_ids')) {
          params.type_ids = sessionStorage.getItem('type_ids')
        }
        var api = new ajax('GET', '/api/merchant/index', params)
        api.then(function (res) {
          init(JSON.parse(res).data)
        })
      })
      function init(data) {
        // $('#header-page').load('header.html')
        // $('#footer-page').load('footer.html')
        $('#category').load('category.html', function () {
          data.indOneName.unshift({ id: 0, ind_name: '全部' })
          initTypeItem(
            data.indOneName,
            sessionStorage.getItem('type_pid') || 0,
            $('#category-container'),
            handleCategoryClick
          )
        })
        var num = Math.floor($('body').innerWidth() / 378)
        if (num >= 4) {
          num = 4
        } else {
          var css = {
            width: '1120px',
            margin: 'auto',
          }
          $('#card-wrapper').css(css)
          $('#guess').css(css)
        }
        initCard(data.merchant.merchantInfo, num, $('#card-wrapper'))
        initGuessCard(data.merchant.guess, num, $('#guess'))
        if (+data.merchant.totalPage <= 1) {
          $('#page').hide()
        } else {
          $('#page').show()
          $('#page').paging({
            pageNo: data.merchant.page,
            totalPage: data.merchant.totalPage,
            totalSize: data.merchant.total,
            callback: function (num) {
              changePage(num)
            },
          })
        }
        if (data.merchant.total === 0) {
          $('#not-found').show()
        } else {
          $('#not-found').hide()
        }
        $('.card-detail-guesss').click(function (e) {
          go('JoininDetails.html?id=' + e.currentTarget.id)
        })
      }
      function initGuessCard(data, num, parent) {
        var el = ''
        for (key in data) {
          var currentData = data[key]
          var flag = (+key + 1) % num
          var temp = [
            '<div class="card card-detail-guesss" id="' +
              currentData.id +
              '" style="height:198px; ' +
              (flag ? '' : 'margin-right:0;') +
              '">',
            '  <div class="card-img" id="' + currentData.id + '">',
            '    <img class="card-img" src="' +
              (currentData.img.indexOf('http') >= 0
                ? currentData.img
                : imgURL + currentData.img) +
              '" alt="' +
              currentData.title +
              '" />',
            '  </div>',
            '  <div class="card-time need-text-overflow" style="bottom:16px">',
            currentData.title,

            '  </div>',
            '</div>',
          ].join('')
          el += temp
        }
        parent.append(el)
      }
      function initCard(data, num, parent) {
        var el = ''
        for (key in data) {
          var currentData = data[key]
          var flag = (+key + 1) % num
          var temp = [
            '<div class="card" ' +
              (flag ? '' : 'style="margin-right:0;"') +
              '>',
            '  <div class="card-img">',
            '    <img class="card-img" src="' +
              (currentData.img.indexOf('http') >= 0
                ? currentData.img
                : imgURL + currentData.img) +
              '" alt="' +
              currentData.title +
              '" />',
            '  </div>',
            '  <div class="card-time">',
            '    <div class="card-model">经营模式：加盟</div>',
            '    <div class="card-fee">预计加盟成本：' +
              (currentData.investment || '暂未公布') +
              '</div>',
            '  </div>',
            '  <div class="card-text need-text-overflow">',
            currentData.title,
            '  </div>',
            '  <div class="card-brand">',
            '    加盟行业：' + currentData.main_ind,
            '  </div>',
            '  <div class="card-detail card-detail-guesss" id="' +
              currentData.id +
              '">加盟详情</div>',
            '</div>',
          ].join('')
          el += temp
        }
        parent.append(el)
        $('.card').hover(
          function () {
            $(this).find('.card-model').css('background', '#F83E25')
          },
          function () {
            $(this).find('.card-model').css('background', '#DBA448')
          }
        )
      }
      function handleCategoryClick(id, type) {
        var params = {
          page: 1,
        }
        if (sessionStorage.getItem('type_pid')) {
          params.type_id = sessionStorage.getItem('type_pid')
        }
        if (sessionStorage.getItem('type_ids')) {
          params.type_ids = sessionStorage.getItem('type_ids')
        }
        if (sessionStorage.getItem('title')) {
          params.title = sessionStorage.getItem('title')
        }
        if (id != 0 && type != 'cancel' && type != 'second') {
          var categoryApi = new ajax('GET', '/api/merchant/typeName', {
            pid: id,
          })
          categoryApi.then(function (res) {
            $('.category-item2 ').remove()
            var categoryData = JSON.parse(res).data
            initSecondTypeItem(categoryData, handleCategoryClick)
          })
        }
        var api = new ajax('GET', '/api/merchant/index', params)
        api.then(function (res) {
          $('.card').remove()
          var data = JSON.parse(res).data
          var lineNum = Math.floor($('body').innerWidth() / 364)
          if (lineNum >= 4) {
            lineNum = 4
          } else {
            var css = {
              width: '1120px',
              margin: 'auto',
            }
            $('#card-wrapper').css(css)
            $('#guess').css(css)
          }
          initCard(data.merchant.merchantInfo, lineNum, $('#card-wrapper'))
          initGuessCard(data.merchant.guess, lineNum, $('#guess'))
          if (+data.merchant.totalPage <= 1) {
            $('#page').hide()
          } else {
            $('#page').show()
            $('#page').paging({
              pageNo: data.merchant.page,
              totalPage: data.merchant.totalPage,
              totalSize: data.merchant.total,
              callback: function (num) {
                changePage(num)
              },
            })
          }
          if (data.merchant.total === 0) {
            $('#not-found').show()
          } else {
            $('#not-found').hide()
          }
        })
      }
    </script>
  </body>
</html>
